package com.sise.dubbo.config.protocolSpi;

import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.rpc.Exporter;
import com.alibaba.dubbo.rpc.Invoker;
import com.alibaba.dubbo.rpc.RpcException;

/**
 * @author linhao
 * @date 2019/5/16
 * @Version V1.0
 */
public interface Protocol {

    /**
     * 暴露远程服务
     *
     * @param invoker
     * @param <T>
     * @return
     * @throws RpcException
     */
    <T> Exporter<T> export(Invoker<T> invoker) throws RpcException;


    /**
     * 引用远程服务
     *
     * @param type
     * @param url
     * @param <T>
     * @return
     * @throws RpcException
     */
    <T> Invoker<T> refer(Class<T> type, URL url) throws RpcException;

}
